3.3.52 \(\int \frac {(e+f x)^2 \cos (c+d x)}{a+a \sin (c+d x)} \, dx\) [252]

Optimal. Leaf size=114 \[ -\frac {i (e+f x)^3}{3 a f}+\frac {2 (e+f x)^2 \log \left (1-i e^{i (c+d x)}\right )}{a d}-\frac {4 i f (e+f x) \text {Li}_2\left (i e^{i (c+d x)}\right )}{a d^2}+\frac {4 f^2 \text {Li}_3\left (i e^{i (c+d x)}\right )}{a d^3} \]

[Out]

-1/3*I*(f*x+e)^3/a/f+2*(f*x+e)^2*ln(1-I*exp(I*(d*x+c)))/a/d-4*I*f*(f*x+e)*polylog(2,I*exp(I*(d*x+c)))/a/d^2+4*
f^2*polylog(3,I*exp(I*(d*x+c)))/a/d^3

________________________________________________________________________________________

Rubi [A]
time = 0.13, antiderivative size = 114, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.192, Rules used = {4613, 2221, 2611, 2320, 6724} \begin {gather*} \frac {4 f^2 \text {PolyLog}\left (3,i e^{i (c+d x)}\right )}{a d^3}-\frac {4 i f (e+f x) \text {PolyLog}\left (2,i e^{i (c+d x)}\right )}{a d^2}+\frac {2 (e+f x)^2 \log \left (1-i e^{i (c+d x)}\right )}{a d}-\frac {i (e+f x)^3}{3 a f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[((e + f*x)^2*Cos[c + d*x])/(a + a*Sin[c + d*x]),x]

[Out]

((-1/3*I)*(e + f*x)^3)/(a*f) + (2*(e + f*x)^2*Log[1 - I*E^(I*(c + d*x))])/(a*d) - ((4*I)*f*(e + f*x)*PolyLog[2
, I*E^(I*(c + d*x))])/(a*d^2) + (4*f^2*PolyLog[3, I*E^(I*(c + d*x))])/(a*d^3)

Rule 2221

Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/((a_) + (b_.)*((F_)^((g_.)*((e_.) +
 (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp[((c + d*x)^m/(b*f*g*n*Log[F]))*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x]
 - Dist[d*(m/(b*f*g*n*Log[F])), Int[(c + d*x)^(m - 1)*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x], x] /; FreeQ[{F,
a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]

Rule 2320

Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Dist[v/D[v, x], Subst[Int[FunctionOfExponentialFu
nction[u, x]/x, x], x, v], x]] /; FunctionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; F
reeQ[{a, m, n}, x] && IntegerQ[m*n]] &&  !MatchQ[u, E^((c_.)*((a_.) + (b_.)*x))*(F_)[v_] /; FreeQ[{a, b, c}, x
] && InverseFunctionQ[F[x]]]

Rule 2611

Int[Log[1 + (e_.)*((F_)^((c_.)*((a_.) + (b_.)*(x_))))^(n_.)]*((f_.) + (g_.)*(x_))^(m_.), x_Symbol] :> Simp[(-(
f + g*x)^m)*(PolyLog[2, (-e)*(F^(c*(a + b*x)))^n]/(b*c*n*Log[F])), x] + Dist[g*(m/(b*c*n*Log[F])), Int[(f + g*
x)^(m - 1)*PolyLog[2, (-e)*(F^(c*(a + b*x)))^n], x], x] /; FreeQ[{F, a, b, c, e, f, g, n}, x] && GtQ[m, 0]

Rule 4613

Int[(Cos[(c_.) + (d_.)*(x_)]*((e_.) + (f_.)*(x_))^(m_.))/((a_) + (b_.)*Sin[(c_.) + (d_.)*(x_)]), x_Symbol] :>
Simp[(-I)*((e + f*x)^(m + 1)/(b*f*(m + 1))), x] + Dist[2, Int[(e + f*x)^m*(E^(I*(c + d*x))/(a - I*b*E^(I*(c +
d*x)))), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && IGtQ[m, 0] && EqQ[a^2 - b^2, 0]

Rule 6724

Int[PolyLog[n_, (c_.)*((a_.) + (b_.)*(x_))^(p_.)]/((d_.) + (e_.)*(x_)), x_Symbol] :> Simp[PolyLog[n + 1, c*(a
+ b*x)^p]/(e*p), x] /; FreeQ[{a, b, c, d, e, n, p}, x] && EqQ[b*d, a*e]

Rubi steps

\begin {align*} \int \frac {(e+f x)^2 \cos (c+d x)}{a+a \sin (c+d x)} \, dx &=-\frac {i (e+f x)^3}{3 a f}+2 \int \frac {e^{i (c+d x)} (e+f x)^2}{a-i a e^{i (c+d x)}} \, dx\\ &=-\frac {i (e+f x)^3}{3 a f}+\frac {2 (e+f x)^2 \log \left (1-i e^{i (c+d x)}\right )}{a d}-\frac {(4 f) \int (e+f x) \log \left (1-i e^{i (c+d x)}\right ) \, dx}{a d}\\ &=-\frac {i (e+f x)^3}{3 a f}+\frac {2 (e+f x)^2 \log \left (1-i e^{i (c+d x)}\right )}{a d}-\frac {4 i f (e+f x) \text {Li}_2\left (i e^{i (c+d x)}\right )}{a d^2}+\frac {\left (4 i f^2\right ) \int \text {Li}_2\left (i e^{i (c+d x)}\right ) \, dx}{a d^2}\\ &=-\frac {i (e+f x)^3}{3 a f}+\frac {2 (e+f x)^2 \log \left (1-i e^{i (c+d x)}\right )}{a d}-\frac {4 i f (e+f x) \text {Li}_2\left (i e^{i (c+d x)}\right )}{a d^2}+\frac {\left (4 f^2\right ) \text {Subst}\left (\int \frac {\text {Li}_2(i x)}{x} \, dx,x,e^{i (c+d x)}\right )}{a d^3}\\ &=-\frac {i (e+f x)^3}{3 a f}+\frac {2 (e+f x)^2 \log \left (1-i e^{i (c+d x)}\right )}{a d}-\frac {4 i f (e+f x) \text {Li}_2\left (i e^{i (c+d x)}\right )}{a d^2}+\frac {4 f^2 \text {Li}_3\left (i e^{i (c+d x)}\right )}{a d^3}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.61, size = 198, normalized size = 1.74 \begin {gather*} \frac {\frac {x \left (3 e^2+3 e f x+f^2 x^2\right ) \left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right )}{\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )}+\frac {2 \left (3 d^2 (e+f x)^2 \log (1-i \cos (c+d x)+\sin (c+d x))-6 i d f (e+f x) \text {Li}_2(i \cos (c+d x)-\sin (c+d x))+6 f^2 \text {Li}_3(i \cos (c+d x)-\sin (c+d x))+\frac {d^3 x \left (3 e^2+3 e f x+f^2 x^2\right ) (-i \cos (c)+\sin (c))}{\cos (c)+i (1+\sin (c))}\right )}{d^3}}{3 a} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[((e + f*x)^2*Cos[c + d*x])/(a + a*Sin[c + d*x]),x]

[Out]

((x*(3*e^2 + 3*e*f*x + f^2*x^2)*(Cos[c/2] - Sin[c/2]))/(Cos[c/2] + Sin[c/2]) + (2*(3*d^2*(e + f*x)^2*Log[1 - I
*Cos[c + d*x] + Sin[c + d*x]] - (6*I)*d*f*(e + f*x)*PolyLog[2, I*Cos[c + d*x] - Sin[c + d*x]] + 6*f^2*PolyLog[
3, I*Cos[c + d*x] - Sin[c + d*x]] + (d^3*x*(3*e^2 + 3*e*f*x + f^2*x^2)*((-I)*Cos[c] + Sin[c]))/(Cos[c] + I*(1
+ Sin[c]))))/d^3)/(3*a)

________________________________________________________________________________________

Maple [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 432 vs. \(2 (101 ) = 202\).
time = 0.13, size = 433, normalized size = 3.80

method result size
risch \(\frac {2 i c^{2} f^{2} x}{d^{2} a}-\frac {2 i e f \,c^{2}}{d^{2} a}-\frac {4 i f^{2} \polylog \left (2, i {\mathrm e}^{i \left (d x +c \right )}\right ) x}{d^{2} a}-\frac {i f^{2} x^{3}}{3 a}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) e^{2}}{d a}+\frac {2 f^{2} c^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d^{3} a}+\frac {4 e f c \ln \left ({\mathrm e}^{i \left (d x +c \right )}\right )}{d^{2} a}-\frac {2 f^{2} c^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}\right )}{d^{3} a}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}\right ) e^{2}}{d a}+\frac {i e^{3}}{3 f a}+\frac {4 i c^{3} f^{2}}{3 d^{3} a}-\frac {4 i e f \polylog \left (2, i {\mathrm e}^{i \left (d x +c \right )}\right )}{d^{2} a}+\frac {4 f^{2} \polylog \left (3, i {\mathrm e}^{i \left (d x +c \right )}\right )}{a \,d^{3}}-\frac {4 i e f c x}{d a}+\frac {i e^{2} x}{a}-\frac {2 f^{2} c^{2} \ln \left (1-i {\mathrm e}^{i \left (d x +c \right )}\right )}{d^{3} a}-\frac {i f e \,x^{2}}{a}+\frac {2 f^{2} \ln \left (1-i {\mathrm e}^{i \left (d x +c \right )}\right ) x^{2}}{d a}-\frac {4 e f c \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d^{2} a}+\frac {4 e f \ln \left (1-i {\mathrm e}^{i \left (d x +c \right )}\right ) x}{d a}+\frac {4 e f \ln \left (1-i {\mathrm e}^{i \left (d x +c \right )}\right ) c}{d^{2} a}\) \(433\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((f*x+e)^2*cos(d*x+c)/(a+a*sin(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

2*I/d^2/a*c^2*f^2*x-2*I/d^2/a*e*f*c^2-1/3*I*f^2/a*x^3+1/3*I/f/a*e^3+2/d/a*ln(exp(I*(d*x+c))+I)*e^2+2/d^3/a*f^2
*c^2*ln(exp(I*(d*x+c))+I)+4/d^2/a*e*f*c*ln(exp(I*(d*x+c)))-2/d^3/a*f^2*c^2*ln(exp(I*(d*x+c)))-2/d/a*ln(exp(I*(
d*x+c)))*e^2+4/3*I/d^3/a*c^3*f^2-4*I/d^2/a*e*f*polylog(2,I*exp(I*(d*x+c)))-4*I/d/a*e*f*c*x+4*f^2*polylog(3,I*e
xp(I*(d*x+c)))/a/d^3-4*I/d^2/a*f^2*polylog(2,I*exp(I*(d*x+c)))*x+I/a*e^2*x-2/d^3/a*f^2*c^2*ln(1-I*exp(I*(d*x+c
)))-I*f/a*e*x^2+2/d/a*f^2*ln(1-I*exp(I*(d*x+c)))*x^2-4/d^2/a*e*f*c*ln(exp(I*(d*x+c))+I)+4/d/a*e*f*ln(1-I*exp(I
*(d*x+c)))*x+4/d^2/a*e*f*ln(1-I*exp(I*(d*x+c)))*c

________________________________________________________________________________________

Maxima [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 297 vs. \(2 (95) = 190\).
time = 0.34, size = 297, normalized size = 2.61 \begin {gather*} -\frac {\frac {6 \, c e f \log \left (a d \sin \left (d x + c\right ) + a d\right )}{a d} - \frac {3 \, e^{2} \log \left (a \sin \left (d x + c\right ) + a\right )}{a} - \frac {-i \, {\left (d x + c\right )}^{3} f^{2} - 3 i \, {\left (d x + c\right )} c^{2} f^{2} + 6 i \, c^{2} f^{2} \arctan \left (\sin \left (d x + c\right ) + 1, \cos \left (d x + c\right )\right ) - 3 \, {\left (i \, d e f - i \, c f^{2}\right )} {\left (d x + c\right )}^{2} + 12 \, f^{2} {\rm Li}_{3}(i \, e^{\left (i \, d x + i \, c\right )}) - 6 \, {\left (i \, {\left (d x + c\right )}^{2} f^{2} + 2 \, {\left (i \, d e f - i \, c f^{2}\right )} {\left (d x + c\right )}\right )} \arctan \left (\cos \left (d x + c\right ), \sin \left (d x + c\right ) + 1\right ) - 12 \, {\left (i \, d e f + i \, {\left (d x + c\right )} f^{2} - i \, c f^{2}\right )} {\rm Li}_2\left (i \, e^{\left (i \, d x + i \, c\right )}\right ) + 3 \, {\left ({\left (d x + c\right )}^{2} f^{2} + c^{2} f^{2} + 2 \, {\left (d e f - c f^{2}\right )} {\left (d x + c\right )}\right )} \log \left (\cos \left (d x + c\right )^{2} + \sin \left (d x + c\right )^{2} + 2 \, \sin \left (d x + c\right ) + 1\right )}{a d^{2}}}{3 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((f*x+e)^2*cos(d*x+c)/(a+a*sin(d*x+c)),x, algorithm="maxima")

[Out]

-1/3*(6*c*e*f*log(a*d*sin(d*x + c) + a*d)/(a*d) - 3*e^2*log(a*sin(d*x + c) + a)/a - (-I*(d*x + c)^3*f^2 - 3*I*
(d*x + c)*c^2*f^2 + 6*I*c^2*f^2*arctan2(sin(d*x + c) + 1, cos(d*x + c)) - 3*(I*d*e*f - I*c*f^2)*(d*x + c)^2 +
12*f^2*polylog(3, I*e^(I*d*x + I*c)) - 6*(I*(d*x + c)^2*f^2 + 2*(I*d*e*f - I*c*f^2)*(d*x + c))*arctan2(cos(d*x
 + c), sin(d*x + c) + 1) - 12*(I*d*e*f + I*(d*x + c)*f^2 - I*c*f^2)*dilog(I*e^(I*d*x + I*c)) + 3*((d*x + c)^2*
f^2 + c^2*f^2 + 2*(d*e*f - c*f^2)*(d*x + c))*log(cos(d*x + c)^2 + sin(d*x + c)^2 + 2*sin(d*x + c) + 1))/(a*d^2
))/d

________________________________________________________________________________________

Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 308 vs. \(2 (98) = 196\).
time = 0.35, size = 308, normalized size = 2.70 \begin {gather*} \frac {2 \, f^{2} {\rm polylog}\left (3, i \, \cos \left (d x + c\right ) - \sin \left (d x + c\right )\right ) + 2 \, f^{2} {\rm polylog}\left (3, -i \, \cos \left (d x + c\right ) - \sin \left (d x + c\right )\right ) - 2 \, {\left (i \, d f^{2} x + i \, d f e\right )} {\rm Li}_2\left (i \, \cos \left (d x + c\right ) - \sin \left (d x + c\right )\right ) - 2 \, {\left (-i \, d f^{2} x - i \, d f e\right )} {\rm Li}_2\left (-i \, \cos \left (d x + c\right ) - \sin \left (d x + c\right )\right ) + {\left (c^{2} f^{2} - 2 \, c d f e + d^{2} e^{2}\right )} \log \left (\cos \left (d x + c\right ) + i \, \sin \left (d x + c\right ) + i\right ) + {\left (d^{2} f^{2} x^{2} - c^{2} f^{2} + 2 \, {\left (d^{2} f x + c d f\right )} e\right )} \log \left (i \, \cos \left (d x + c\right ) + \sin \left (d x + c\right ) + 1\right ) + {\left (d^{2} f^{2} x^{2} - c^{2} f^{2} + 2 \, {\left (d^{2} f x + c d f\right )} e\right )} \log \left (-i \, \cos \left (d x + c\right ) + \sin \left (d x + c\right ) + 1\right ) + {\left (c^{2} f^{2} - 2 \, c d f e + d^{2} e^{2}\right )} \log \left (-\cos \left (d x + c\right ) + i \, \sin \left (d x + c\right ) + i\right )}{a d^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((f*x+e)^2*cos(d*x+c)/(a+a*sin(d*x+c)),x, algorithm="fricas")

[Out]

(2*f^2*polylog(3, I*cos(d*x + c) - sin(d*x + c)) + 2*f^2*polylog(3, -I*cos(d*x + c) - sin(d*x + c)) - 2*(I*d*f
^2*x + I*d*f*e)*dilog(I*cos(d*x + c) - sin(d*x + c)) - 2*(-I*d*f^2*x - I*d*f*e)*dilog(-I*cos(d*x + c) - sin(d*
x + c)) + (c^2*f^2 - 2*c*d*f*e + d^2*e^2)*log(cos(d*x + c) + I*sin(d*x + c) + I) + (d^2*f^2*x^2 - c^2*f^2 + 2*
(d^2*f*x + c*d*f)*e)*log(I*cos(d*x + c) + sin(d*x + c) + 1) + (d^2*f^2*x^2 - c^2*f^2 + 2*(d^2*f*x + c*d*f)*e)*
log(-I*cos(d*x + c) + sin(d*x + c) + 1) + (c^2*f^2 - 2*c*d*f*e + d^2*e^2)*log(-cos(d*x + c) + I*sin(d*x + c) +
 I))/(a*d^3)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \frac {\int \frac {e^{2} \cos {\left (c + d x \right )}}{\sin {\left (c + d x \right )} + 1}\, dx + \int \frac {f^{2} x^{2} \cos {\left (c + d x \right )}}{\sin {\left (c + d x \right )} + 1}\, dx + \int \frac {2 e f x \cos {\left (c + d x \right )}}{\sin {\left (c + d x \right )} + 1}\, dx}{a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((f*x+e)**2*cos(d*x+c)/(a+a*sin(d*x+c)),x)

[Out]

(Integral(e**2*cos(c + d*x)/(sin(c + d*x) + 1), x) + Integral(f**2*x**2*cos(c + d*x)/(sin(c + d*x) + 1), x) +
Integral(2*e*f*x*cos(c + d*x)/(sin(c + d*x) + 1), x))/a

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((f*x+e)^2*cos(d*x+c)/(a+a*sin(d*x+c)),x, algorithm="giac")

[Out]

integrate((f*x + e)^2*cos(d*x + c)/(a*sin(d*x + c) + a), x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {\cos \left (c+d\,x\right )\,{\left (e+f\,x\right )}^2}{a+a\,\sin \left (c+d\,x\right )} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((cos(c + d*x)*(e + f*x)^2)/(a + a*sin(c + d*x)),x)

[Out]

int((cos(c + d*x)*(e + f*x)^2)/(a + a*sin(c + d*x)), x)

________________________________________________________________________________________